<?php
/**
 * Module used for application session variables
 *
 * @author André Silva
 */
class Session implements IModule {
	public static function start($args) {
		session_start();
	}

	public static function finish() {

	}

	/**
	 * Set a session value
	 * @param string $name
	 * @param mixed $value
	 */
	public static function set($name, $value) {
		$_SESSION[$name] = $value;
	}

	/**
	 * Get a sesino value
	 * @param string $name
	 * @return mixed
	 */
	public static function get($name) {
		return (!isset($_SESSION[$name])) ? null : $_SESSION[$name];
	}

	/**
	 * Remove a session value
	 * @param string $name
	 */
	public static function delete($name) {
		unset($_SESSION[$name]);
	}

	/**
	 * Destroy all data registered in session
	 */
	public static function destroy() {
		session_destroy();
	}
}
?>
